'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: app_service.py
* @Time: 2025/11/5
* @All Rights Reserve By Brtc
'''
import dotenv
from aiohttp.web_middlewares import middleware
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_weaviate import FlaskWeaviate

from app.http.module import  app_injector
from config.config import Config
from internal.middleware.middleware import Middleware
from internal.router import Router
from internal.server.http import Http
from pkg.sqlalchemy import SQLAlchemy

# 环境变量加载
dotenv.load_dotenv()
#全局配置
app_config = Config()
#http 服务器 实例
app = Http(__name__,
           config=app_config, # 全局配置
           db=app_injector.get(SQLAlchemy) , # 数据库
           weaviate = app_injector.get(FlaskWeaviate), # 向量数据库
           migrate=app_injector.get(Migrate), # 数据库迁移
           router=app_injector.get(Router),
           login_manager = app_injector.get(LoginManager),
           middleware = app_injector.get(Middleware)) # url 路由
celery = app.extensions['celery']

if __name__ == '__main__':
    # 服务运行
    app.run(debug=True)